/**
 * @Author Fish Paradise
 * @Description
 * @Date 2019/1/14  19:56
 **/
public class BookShelfIterator implements BookIterator {
    private BookShelf bookShelf;
    private int index;
    public BookShelfIterator(BookShelf bookShelf) {
        this.bookShelf = bookShelf;
        this.index=0;
    }

    public boolean hasNext() {
        return index<bookShelf.getLength();
    }

    public Book next() {
        return bookShelf.getBookAt(index++);
    }
}
